<?php

namespace App\Models\Sys;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $table = 'sys_user';

    protected $casts = [
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s',
    ];
    //获取所有用户
    public function getAllUser($param)
    {
        $pageSize = $param['size'] ?? 10;
        return $this->paginate($pageSize);
    }

    public function getUser($id)
    {
        return $this->where('id','=',$id)->first();
    }

    public function updateds($id,$data)
    {
        $res=$this->where('id','=',$id)->update($data);
        if($res){
            return true;
        }
        return false;
    }

}
